import { BaseDto, BaseQueryDto } from '@/dtos/base.dto';
import { Prisma } from '@prisma/client';
import { IsDefined, Max, Min } from "class-validator";
import { Transform } from 'class-transformer';

export class WishQueryDto extends BaseQueryDto<Prisma.WishWhereUniqueInput> {}

export class WishOrderDto {
  @IsDefined({ message: '金额必填' })
  @Transform(({ value }) => Number(value))
  @Min(1, { message: '金额最小为1' })
  price: number;

  @IsDefined({ message: '数量必填' })
  @Transform(({ value }) => Number(value))
  @Min(1, { message: '数量最小为1' })
  @Max(10, { message: '数量最大为10' })
  count: number;

  @IsDefined({ message: '资产ID必填' })
  @Transform(({ value }) => Number(value))
  assetId: number;

  @IsDefined({ message: '密码必填' })
  pass: string;
}

export class WishTransaction2Dto {
  @IsDefined({ message: 'UID必填' })
  @Transform(({ value }) => Number(value))
  uid: number;

  @IsDefined({ message: '订单号必填' })
  no: string;
}
